package com.lagou.boot;

import com.lagou.client.RPCConsumer;
import com.lagou.protocol.RpcRequest;
import com.lagou.service.IUserService;

public class ConsumerBoot {

    //参数定义
    //private static final String PROVIDER_NAME = "UserService#sayHello#";

    public static void main(String[] args) throws InterruptedException {

       // 定义RpcRequest对象作为通信协议，
        // 1.创建代理对象
        RPCConsumer rpcConsumer=new RPCConsumer();
        IUserService service = (IUserService) rpcConsumer.createProxy(IUserService.class);

        //2.循环给服务器写数据
        while (true){
            System.out.println("客户端发起请求～");
            String result = service.sayHello("are you okay!");
            System.out.println(result);
            Thread.sleep(2000);
        }

    }
}
